import { request } from '@/utils/request'
import { findByStorageKey } from '@/utils/localStorageUtil'

//保存spu
export const saveSpu = (data)=>{
  return request.post("/product/save",data,{
    headers: {
      accessToken: findByStorageKey('accessToken')
    }
  })
}

//更新spu
export const updateSpu = (data)=>{
  return request.post("/product/update",data,{
    headers: {
      accessToken: findByStorageKey('accessToken')
    }
  })
}

//查询spu
export const findSpu = (categoryId)=>{
  return request.get(`/product/list/${categoryId}`,{
    headers: {
      accessToken: findByStorageKey('accessToken')
    }
  })
}

//查询spu
export const findSpuById = (spuId)=>{
  return request.get(`/product/product/${spuId}`,{
    headers: {
      accessToken: findByStorageKey('accessToken')
    }
  })
}